<?php
// car组件，购物车列表
include_once "conn.php";
$token = $_POST['token'];
$arr=[];
$sql=$db->query("SELECT * FROM goods JOIN car ON goods.`goods_id` = 
                 car.`goods_id` WHERE car.`user_id` = 
                 (SELECT user_id FROM user WHERE user_token = '$token')");
while ($row=$sql->fetch_assoc()) {
    array_push($arr,$row);
}
echo json_encode($arr);
$db->close();
?>